package net.kleinhenz.droidshop.system;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class WSServletContextListener implements ServletContextListener 
{
    private static ServletContext ctx = null;

    public void contextDestroyed(ServletContextEvent event) 
    {
        setServletContext(null);
    }

    public void contextInitialized(ServletContextEvent event) 
    {
        setServletContext(event.getServletContext());
    }

    public static ServletContext getServletContext() 
    {
        return ctx;
    }

    public static void setServletContext(ServletContext context) 
    {
        ctx = context;
    }

    public static boolean inJ2EEMode() 
    {
        return ctx == null ? false : true;
    }
}
